From fcd8d64078444c08fe103a11e3291bd170182ec2 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 28 Feb 2008 10:19:49 +0000 Subject: [PATCH] Fix non-portability in xentrace Replace statfs() with the equivalent statvfs(), and correct the block size multiplier. Signed-off-by: John Levon --- tools/xentrace/xentrace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c index 526a69f73d..aaef3f09fb 100644 --- a/tools/xentrace/xentrace.c +++ b/tools/xentrace/xentrace.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include @@ -87,7 +87,7 @@ void close_handler(int signal) void write_buffer(unsigned int cpu, unsigned char *start, int size, int total_size, int outfd) { - struct statfs stat; + struct statvfs stat; size_t written = 0; if ( opts.disk_rsvd != 0 ) @@ -95,13 +95,13 @@ void write_buffer(unsigned int cpu, unsigned char *start, int size, unsigned long long freespace; /* Check that filesystem has enough space. */ - if ( fstatfs (outfd, &stat) ) + if ( fstatvfs (outfd, &stat) ) { fprintf(stderr, "Statfs failed!\n"); goto fail; } - freespace = stat.f_bsize * (unsigned long long)stat.f_bfree; + freespace = stat.f_frsize * (unsigned long long)stat.f_bfree; if ( total_size ) freespace -= total_size; -- 2.30.2